package com.woupla.search;

import java.util.List;

import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;

import org.jboss.solder.logging.Logger;

import com.woupla.model.Planing;


@Stateless
public class SearchEJB {
	@Inject
	private Logger log;

	@Inject
	private EntityManager em;
	
	public List<Planing> findPlaning(String city){
		TypedQuery<Planing> query =  em.createNamedQuery("Planing.findByCompany",Planing.class);
		query.setParameter("city",city);
		List<Planing> planing = query.getResultList();
	/*	if (planing.isEmpty())
		{
			TypedQuery<Planing> queryStatic =  em.createNamedQuery("findByEmployeeStatic",Planing.class);
			queryStatic.setParameter("employee", user.getId());
			planing = queryStatic.getResultList();
		}*/
		return planing;
		
	}
	
	


}
